package com.tywj.panda.customer.common.view.dialog

import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.tywj.panda.customer.common.R
import com.tywj.panda.customer.common.view.BaseDialog
import kotlinx.android.synthetic.main.common_dialog_loading.*

/**
 * @desc 加载中弹窗
 * @author June Yang
 * @date 2017/6/22
 */
class LoadingDialog : BaseDialog() {

    companion object {
        const val TAG = "LoadingDialog"
    }

    override fun getLayoutID(): Int = R.layout.common_dialog_loading

    override fun getFragmentTag(): String = TAG

    override fun getGravity(): Int = Gravity.CENTER

    override fun getCancelOutside(): Boolean = false

    override fun getCancelable(): Boolean = false

    override fun getWidth(): Int = WindowManager.LayoutParams.WRAP_CONTENT

    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)

        loadingView.startAnimation()
    }

    override fun onResume() {
        super.onResume()

        loadingView.startAnimation()
    }

    override fun onPause() {
        super.onPause()

        loadingView.cancelAnimation()
    }
}